import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/http/bean/wroks/contract_bean.dart';
import 'package:app/src/http/bean/wroks/delivery_notice.dart';
import 'package:app/src/ui/app_ui.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_card.dart';

///发货审核：通知单信息
class UiDeliveryNoticeInfo {
  ///data 信息
  ///oldData 历史信息
  static Widget build(BuildContext context, DeliveryNotice? data,
      DeliveryNotice? oldData,{String? title}) {
    if(StringUtils.isEmpty(data)){
      return AppUi.getEmptyView();
    }
    List<Widget> children = [];
    if(StringUtils.isEmpty(title)){
      title=AppStrings.of(context).NoticeInfo;//通知单信息
    }
    children.add(
        UiBase.title(context, title)); //标题
    children.add(UiBase.item(context, AppStrings.of(context).NoticeId,
        data?.NoticeId, oldData?.NoticeId)); //通知单号
    children.add(UiBase.item(context, AppStrings.of(context).NoticeDatetime,
        data?.NoticeDatetime, oldData?.NoticeDatetime)); //通知日期
    children.add(UiBase.item(context, AppStrings.of(context).MerchandiserName2,
        data?.MerchandiserName, oldData?.MerchandiserName)); //跟单员
    children.add(UiBase.item(context, AppStrings.of(context).SalesmanName2,
        data?.SalesmanName, oldData?.SalesmanName)); //业务员
    children.add(UiBase.item(context, AppStrings.of(context).ContractCode,
        data?.ContractCode, oldData?.ContractCode)); //合同编号
    children.add(UiBase.item(context, AppStrings.of(context).OutCode,
        data?.OutCode, oldData?.OutCode)); //合同外部编号
    children.add(UiBase.item(context, AppStrings.of(context).ProjectName,
        data?.ProjectName, oldData?.ProjectName)); //项目名称
    children.add(UiBase.item(context, AppStrings.of(context).CustomerName,
        data?.CustomerName, oldData?.CustomerName)); //客户名称
    children.add(UiBase.item(context, AppStrings.of(context).Balanceamount,
        data?.Balanceamount, oldData?.Balanceamount)); //结算额度
    children.add(UiBase.item(context, AppStrings.of(context).Currentdebt,
        data?.Currentdebt, oldData?.Currentdebt)); //当前欠款
    children.add(UiBase.item(context, AppStrings.of(context).Debt,
        data?.Debt, oldData?.Debt)); //合计欠款
    children.add(UiBase.item(context, AppStrings.of(context).Otheramount,
        data?.Otheramount, oldData?.Otheramount)); //其他费用
    children.add(UiBase.item(context, AppStrings.of(context).CurrentArea,
        data?.CurrentArea, oldData?.CurrentArea)); //发货面积
    children.add(UiBase.item(context, AppStrings.of(context).Currentamount,
        data?.Currentamount, oldData?.Currentamount)); //发货金额
    children.add(UiBase.item(context, AppStrings.of(context).Toaddress,
        data?.Toaddress, oldData?.Toaddress)); //收获地址
    children.add(UiBase.item(context, AppStrings.of(context).Towho,
        data?.Towho, oldData?.Towho)); //收货人
    children.add(UiBase.item(context, AppStrings.of(context).Totelephone,
        data?.Totelephone, oldData?.Totelephone)); //联系电话
    children.add(UiBase.item(context, AppStrings.of(context).CarNum,
        data?.CarNum, oldData?.CarNum)); //总车数
    children.add(UiBase.item(context, AppStrings.of(context).Isfreeshipping,
        data?.Isfreeshipping, oldData?.Isfreeshipping)); //是否包含运费
    if(data?.isShowCustomerFreight()??false){
      //显示客户运费
      children.add(UiBase.item(context, AppStrings.of(context).CustomerFreight,
          data?.CustomerFreight, oldData?.CustomerFreight)); //客户运费
    }
    children.add(UiBase.item(context, AppStrings.of(context).DeliveryDatetime,
        data?.DeliveryDatetime, oldData?.DeliveryDatetime)); //通知发货日期
    children.add(UiBase.item(context, AppStrings.of(context).CarFactory,
        data?.CarFactory, oldData?.CarFactory)); //是否跨厂拼车
    children.add(UiBase.item(context, AppStrings.of(context).OrderCodes,
        data?.OrderCodes, oldData?.OrderCodes)); //订单编号
    children.add(UiBase.item(context, AppStrings.of(context).Positioncodes,
        data?.Positioncodes, oldData?.Positioncodes)); //架卡编号
    var column = UiBase.column(context, children);
    var card = UiCard.build(context, column);
    return card;
  }
}